﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Coding4Fun.Phone.Controls;

namespace Liuyi.Phone.LiveMSN
{
    public class Liuyi
    {
        /// <summary>
        /// msn Home
        /// </summary>
        /// 我的字段 LIUYI-PC Liuyi 2012/1/9 创建
        public static Uri homeUri = new Uri("Http://live.com");

        /// <summary>
        /// Get_s the progress indicator.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <returns></returns>
        /// 我的方法 LIUYI-PC Liuyi 2012/1/9 创建
        internal static ProgressIndicator get_ProgressIndicator(string text)
        {
            return new Microsoft.Phone.Shell.ProgressIndicator()
            {
                IsVisible = true,
                Text = text,
            };
        }

        /// <summary>
        /// Do_s the web title.
        /// </summary>
        /// <param name="___WebBrowser_msn">The ___ web browser_msn.</param>
        /// 我的方法 LIUYI-PC Liuyi 2012/1/9 创建
        internal static void do_WebTitle(WebBrowser ___WebBrowser_msn)
        {
            ___WebBrowser_msn.InvokeScript("execScript", new string[] { "window.external.Notify(document.title);" });
        }

        /// <summary>
        /// Do_s the web back.
        /// </summary>
        /// <param name="___WebBrowser_msn">The ___ web browser_msn.</param>
        /// 我的方法 LIUYI-PC Liuyi 2012/1/9 创建
        internal static void do_WebBack(WebBrowser ___WebBrowser_msn)
        {
            ___WebBrowser_msn.InvokeScript("eval", new string[] { "history.go(-1);" });
        }

        /// <summary>
        /// Get_s the back prompt.
        /// </summary>
        /// <param name="___WebBrowser_msn">The ___ web browser_msn.</param>
        /// <returns></returns>
        /// 我的方法 LIUYI-PC Liuyi 2012/1/9 创建
        internal static MessagePrompt get_BackPrompt(WebBrowser ___WebBrowser_msn)
        {
            var mp = new MessagePrompt();
            mp.IsAppBarVisible = true;
            mp.Body = new UCBackControl(mp, ___WebBrowser_msn);
            return mp;
        }

        /// <summary>
        /// Get_s the about prompt.
        /// </summary>
        /// <returns></returns>
        /// 我的方法 LIUYI-PC Liuyi 2012/1/9 创建
        internal static MessagePrompt get_AboutPrompt()
        {
            return new MessagePrompt()
            {

            };
        }

        /// <summary>
        /// Get_s the help prompt.
        /// </summary>
        /// <returns></returns>
        /// 我的方法 LIUYI-PC Liuyi 2012/1/9 创建
        internal static MessagePrompt get_HelpPrompt()
        {
            return new MessagePrompt()
            {

            };
        }

        /// <summary>
        /// Exits this instance.
        /// </summary>
        /// Name consists of a single word LIUYI-PC Liuyi 2012/1/9 创建
        internal static void Exit()
        {
            new string[] { }[0] = "Exit!";
        }

        internal static void showException(System.Windows.Navigation.NavigationFailedEventArgs e)
        {
            try
            {
                MessageBox.Show(e.Exception.Message);
            }
            catch (Exception)
            {
                MessageBox.Show("导航失败，请检查网络。");
            }
        }

        internal static void do_NavigateToHome(WebBrowser ___WebBrowser_msn)
        {
            ___WebBrowser_msn.Navigate(Liuyi.homeUri);
        }
    }
}
